//
//  WorkOrderCell.m
//  NewPro
//
//  Created by RYX on 2018/11/22.
//  Copyright © 2018年 何荧红. All rights reserved.
//

#import "WorkOrderCell.h"
#import "WorkOrderModel.h"

@interface WorkOrderCell ()
{
    
    __weak IBOutlet UILabel *noLa;
    
    __weak IBOutlet UILabel *typeLa;
    
    __weak IBOutlet UILabel *timeLa;
    
    __weak IBOutlet UILabel *statusLa;
}

@end

@implementation WorkOrderCell

+ (instancetype)tempWithTableView:(UITableView *)tableView{
    
    WorkOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    if (!cell) {
        
        cell = [self cell];
    }
    
    return cell;
}

+ (CGFloat)getHeight{
    
    UITableViewCell *cell = [self cell];
    return cell.frame.size.height;
}

+ (instancetype)cell{
    
    ClassName
    return [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] objectAtIndex:0];
}

- (void)setModel:(WorkOrderModel *)model{
    
    noLa.text = [NSString stringWithFormat:@"工单号：%@",model.workOrderNo];
    typeLa.text = [NSString stringWithFormat:@"类型：%@",model.workOrderType];
    timeLa.text = [NSString stringWithFormat:@"%@",model.gmtCreate];
    
    if ([model.workOrderState isEqualToString:@"1"]) {
        
        statusLa.text = [NSString stringWithFormat:@"请于%@个工作日内处理",model.processTime];
        statusLa.textColor = [UIColor colorWithHexString:@"#FF2F2F"];
    }
    
    if ([model.workOrderState isEqualToString:@"2"]) {
        
        statusLa.text = @"审核中";
        statusLa.textColor = [UIColor colorWithHexString:@"#F0AD59"];
    }
    
    if ([model.workOrderState isEqualToString:@"3"]) {
        
        statusLa.text = @"处理失败";
        statusLa.textColor = [UIColor colorWithHexString:@"#FF2F2F"];
    }
    
    if ([model.workOrderState isEqualToString:@"4"]) {
        
        statusLa.text = @"处理完成";
        statusLa.textColor = [UIColor colorWithHexString:@"#4DD28B"];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
